<?php

namespace Rebecca\RebeccaBundle\Twig;

use Twig_Extension;
use Twig_Filter_Method;
use Twig_Function_Method;

class RebeccaExtension extends Twig_Extension
{
    public function getFilters()
    {
        return array(
            'number_format' => new Twig_Filter_Method($this, 'numberFormat'),
        );
    }

    public function numberFormat($number, $decimals = 0, $decPoint = '.', $thousandsSep = ',')
    {
        $number = number_format($number, $decimals, $decPoint, $thousandsSep);
        
        return $number;
    }

    public function getName()
    {
        return 'rebecca_extension';
    }
}
